//
//  GFTbTableViewCell.m
//  Qyer
//
//  Created by dlios on 15/10/21.
//  Copyright (c) 2015年 GF. All rights reserved.
//

#import "GFTbTableViewCell.h"

@implementation GFTbTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _image = [[UIImageView alloc] initWithFrame:CGRectMake(5 * WIDTH, 5 * HEIGHT, SCREEN_WIDTH - 10 * WIDTH, 220 * HEIGHT)];
        [self.contentView addSubview:_image];
        
        _nameLable = [[UILabel alloc] initWithFrame:CGRectMake(5 * WIDTH, 5 * HEIGHT, SCREEN_WIDTH - 10 * WIDTH, 20 * HEIGHT)];
        [_nameLable setTextColor:[UIColor whiteColor]];
        [_nameLable setFont:[UIFont systemFontOfSize:WIDTH * 16.]];
        [_image addSubview:_nameLable];
        
        _timeLable = [[UILabel alloc] initWithFrame:CGRectMake(5 * WIDTH, 25 * HEIGHT, SCREEN_WIDTH - 10 * WIDTH, 20 * HEIGHT)];
        [_timeLable setTextColor:[UIColor whiteColor]];
        [_timeLable setFont:[UIFont systemFontOfSize:WIDTH * 13.]];
        [_image addSubview:_timeLable];
        
        _userIamge = [[UIImageView alloc] initWithFrame:CGRectMake(5 * WIDTH, 175 * HEIGHT, 40 * WIDTH, 40 * HEIGHT)];
        [_image addSubview:_userIamge];
        
        _userLable = [[UILabel alloc] initWithFrame:CGRectMake(50 * WIDTH, 185 * HEIGHT, SCREEN_WIDTH - 30 * WIDTH, 20 * HEIGHT)];
        [_userLable setTextColor:[UIColor whiteColor]];
        [_userLable setFont:[UIFont systemFontOfSize:WIDTH * 13.]];
        [_image addSubview:_userLable];
        
        _titleLable = [[UILabel alloc] initWithFrame:CGRectMake(5 * WIDTH, 185 * HEIGHT, SCREEN_WIDTH - 10 * WIDTH, 20 * HEIGHT)];
        [_titleLable setTextColor:[NightMode shareNightModeHandle].wordColor];
        [_titleLable setFont:[UIFont systemFontOfSize:WIDTH * 13.]];
        [_image addSubview:_titleLable];
    }
    return self;
}

- (void)getTableModel:(GFTbModel *)model{
    [_image sd_setImageWithURL:[NSURL URLWithString:model.front_cover_photo_url] placeholderImage:[UIImage imageNamed:@"zw.png"]];
    [_nameLable setText:model.name];
    NSString *string = [NSString stringWithFormat:@"%@ / %@", model.start_date, model.end_date];
    [_timeLable setText:string];
    [_userLable setText:[model.user objectForKey:@"name"]];
    [_userIamge sd_setImageWithURL:[NSURL URLWithString:[model.user objectForKey:@"image"]] placeholderImage:[UIImage imageNamed:@"zw.png"]];
}

- (void)getjnmodel:(GFJnModel *)model{
    [_image sd_setImageWithURL:[NSURL URLWithString:model.image_url] placeholderImage:[UIImage imageNamed:@"zw.png"]];
    [_nameLable setText:model.name];
    [_titleLable setText: model.title];
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
